/*
 * demo1.cpp
 *
 *  Created on: 2012-8-20
 *      Author: huangyansheng
 */

#include <gtest/gtest.h>
//计算商品总价
int total_3(int price,int number)
{
	if(price<0)
		return -1;
	else if(number<0)
		return -1;
	else
		return price*number;
}

TEST(total_3,price1){
	EXPECT_EQ(10,total_3(1,10));
	EXPECT_EQ(10,total_3(2,5));
	EXPECT_EQ(10,total_3(5,2));
	EXPECT_EQ(10,total_3(10,1));
}
TEST(total_3,price_zero){
	EXPECT_EQ(0,total_3(0,10));
	EXPECT_EQ(0,total_3(10,0));
}
TEST(total_3,price_negative){
	EXPECT_EQ(-1,total_3(-1,10));
	EXPECT_EQ(-1,total_3(10,-1));
	EXPECT_EQ(-1,total_3(-10,-1));
}

